﻿$(function() {
    BindCheckBoxEvent();
    $("#btn_save,#btn_save2").click(function() {
        $(this).attr("disabled", "disabled").after("<span style=\"color:red;\">提交中.....</span>");

        var fids = "";
        $("input:checked").not("#cb_All,#cb_All2").each(function() {
            fids += $(this).val() + ",";
        });

        $.ajax({
            type: "POST",
            url: "../api/access.ashx",
            data: { type: 'saverolefunctions', roleid: roleid, fids: fids, r: Math.random() },
            dataType: "string",
            success: function(data) {

                if (data == 1) {
                    facebox("操作成功！");
                }
                else {
                    facebox("操作失败！" + data);
                }
                $("#btn_save,#btn_save2").attr("disabled", "").next("span").remove();
            }
        });
    });
    formReady();
});       